package com.sunkyc.commons.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum DataScopeType {

    CUSTOM("1"),
    DEPT("2"),
    DEPT_AND_CHILD("3"),
    SELF("4");

    private String code;
    public static DataScopeType findCode(String code) {
        if (StrUtil.hasBlank(code)) {
            return null;
        }
        for (DataScopeType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

}
